1. Field of the Invention
The invention relates to packet switching.
2. Related Art
In a packet-switched network, a “router” is a device which receives packets on one or more input interfaces and which outputs those packets on one of a plurality of output interfaces, so as to move those packets within the network from a source device to a destination device. Each packet includes header information which indicates the destination device (and other information), and the router includes routing information which associates an output interface with information about the destination device (possibly with other information). The router can also perform other operations on packets, such as rewriting the packets according to their routing protocol or to reencapsulate the packets from a first routing protocol to a second routing protocol. It is advantageous for routers to operate as quickly as possible, so that as many packets as possible can be switched in a unit time.
One operation performed by routers is routing lookup, that is, accessing routing information in response to the header information from the packet. For example, the router can determine an output interface on which to output the packet in response to a destination address specified by the packet header. In some routing protocols such as IP, an entire set of destination addresses can be associated with a single output interface, so that the operation of routing lookup can be responsive to routing information of differing lengths.
A first problem which has arisen in the art is that storing and retrieving routing information can be both complex and slow, due to the number of differing ways in which the destination address or other packet header information can be associated with that routing information. For example, methods by which the router might perform routing lookup for longer sets of routing lookup information can be inefficient for shorter sets of routing lookup information, and methods by which the router might perform routing lookup for shorter sets of routing lookup information can be inefficient for longer sets of routing lookup information.
A second problem which has arisen in the art is that header information associated with routing lookup has been seen to follow identifiable patterns, particularly for IP addresses used in the internet. Among those identifiable patterns are that 21-bit and 24-bit destination address headers are relatively common, while 32-bit destination addresses and 8-bit destination address headers are relatively rare. Thus, methods by which the router might perform routing lookup should be efficient for lookup of middle-length destination addresses without being inefficient for lookup of relatively longer or shorter destination addresses.
Some known routers, such as those described in U.S. application Ser. No. 08/655,429, now U.S. Pat. No. 6,243,661 issued Jun. 5, 2001, “Network Flow Switching and Flow Data Export”, in the name of inventors Darren Kerr and Barry Bruins, and assigned to Cisco Systems, Inc., and U.S. application Ser. No. 08/771,438, now U.S. Pat. No. 6,308,148 issued Oct. 23, 2001, having the same title, in the name of the same inventors, assigned to the same assignee, can perform routing lookup for differing length destination addresses, by successively performing routing lookup for successive bytes of the destination address. Thus, each byte of the destination address provides further information from which specific information for routing the packet can be addressed. While this method achieves the goal of being relatively flexible with regard to the length of the destination address required for routing lookup, it can take many clock cycles to perform routing lookup, and is therefore not as relatively quick as desired. Moreover, while this method is relatively efficient for relatively shorter length destination addresses, it becomes increasingly inefficient as the lengths of destination addresses become relatively longer.
Accordingly, it would be desirable to provide a method and system for performing routing lookup, which is responsive to a plurality of different sets of routing 9 lookup information. This advantage is achieved in an embodiment of the invention in which a plurality of sets of routing lookup information are queued for lookup in an external memory, particularly where a plurality of sets of routing lookup information are distinguished both by packet routing information and to the length of that header information.